package com.example.customer.controller;

import com.example.customer.service.recognizeeService;
import entity.recognizee_info;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@CrossOrigin(methods = {RequestMethod.POST,RequestMethod.GET})
@Controller
@RequestMapping("/recognizee")
public class recognizeeController {
    @Autowired
    private recognizeeService recognizeeService;

    @ResponseBody
    @RequestMapping("/addRecognizee.do")
    public int add(@RequestBody recognizee_info r){

        return this.recognizeeService.addRecognizeeinfo(r);

    }

    @ResponseBody
    @RequestMapping("/delRecognizee.do")
    public int del(Integer id) throws Exception {

        return this.recognizeeService.delRecognizeeinfo(id);
    }

    @RequestMapping("/getRecognizee.do")
    public @ResponseBody recognizee_info get(Integer id) throws Exception{
        return this.recognizeeService.getRecognizeeinfo(id);
    }
    @ResponseBody
    @RequestMapping("/updateRecognizee.do")
    public int updateUser(@RequestBody recognizee_info r)throws Exception{
        System.out.println(r.getSex());
        System.out.println(r.getAddress());
        System.out.println(r.getBank_number());
        System.out.println(r.getCredentials_number());
        System.out.println(r.getCredentials_type());
        System.out.println(r.getDrive_number());
        System.out.println(r.getEmail());
        System.out.println(r.getMob());
        System.out.println(r.getRecognizee_name());
        System.out.println(r.getRecognizee_number());
        return this.recognizeeService.upRecognizeeinfo(r);

    }

}
